package org.zjvis.datascience.common.vo;

import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import org.zjvis.datascience.common.dto.PluginDTO;
import org.zjvis.datascience.common.util.DozerUtil;

@Data
public class PluginVO extends BaseVO {
    private Long id;
    private String name;
    private String token;
    private Integer status; //0-off  1-on
    private String url;
    private String version;
    private String iconEncode;
    private JSONObject data;
    private String description;

    private Long instanceId;

    public PluginDTO toPlugin() {
        PluginDTO dto = DozerUtil.mapper(this, PluginDTO.class);
        if (this.data != null) {
            dto.setDataJson(this.data.toJSONString());
        }
        return dto;
    }
}
